

<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>Phu Trung Hoa - Control Panel</title>
	<link rel="stylesheet" type="text/css" href="css/admin.css">
</head>
<body>	
	<!-- <?php
		//load library
		include("config.php");
		
		//connect db
		Model::connect();
	
		//check auth
		/*if($_SESSION["uname"]=="")
		{
			echo  
			(
				"--><script>
					window.location='log.php';
				</script><!--"
			);			
		}*/
	
		/* LIBRARY */
		function dieN($error)
		{
			echo("<div style='color:#FFFFFF'><pre>");
			print_r($error);
			echo("</pre></div>");			
			die();
		}
		function thumbnail($image_name,$type,$width,$height,$source_path,$destination_path)
		{
			if($type=="image/pjpeg" OR $type=="image/jpeg")
			{
				$srcimg=imagecreatefromjpeg($source_path.$image_name) or die("Problem In opening Source Image");
			}
			if($type=="image/gif")	
			{
				$srcimg=imagecreatefromgif($source_path.$image_name) or die("Problem In opening Source Image");	
			}
			
			if($type=="image/x-png")	
			{
				$srcimg=imagecreatefrompng($source_path.$image_name) or die("Problem In opening Source Image");	
			}
						
			$old_x=imagesx($srcimg);
			$old_y=imagesy($srcimg);
			
			$rate=$old_x/$old_y;			
			$thumb_w=$width;
			$thumb_h=$thumb_w/$rate;
			
			if($thumb_h>$height)
			{
				$rate=$thumb_h/$height;
				$thumb_w=$thumb_w/$rate;
				$thumb_h=$height;
			}
			
			$destimg=imagecreatetruecolor($thumb_w,$thumb_h) or die("Problem In Creating image");  
			imagecopyresampled($destimg,$srcimg,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y) or die("Problem In resizing"); 
				
			if($type=="image/pjpeg" OR $type=="image/jpeg")	 
			{
				imagejpeg($destimg,$destination_path.$image_name) or die("Problem In saving");
			}
			if($type=="image/gif")
			{
				imagegif($destimg,$destination_path.$image_name) or die("Problem In saving");
			}
			if($type=="image/x-png")	
			{
				imagepng($destimg,$destination_path.$image_name) or die("Problem In saving");
			}
		}
		/* END LIBRARY */
		
		/* DEFINE ZONE */
		$zone=$_GET["zone"];
		$arrMenu=array
		(
			"config"=>"CẤU HÌNH HỆ THỐNG",
			"product_type"=>"QUẢN LÝ LOẠI SẢN PHẨM",
			"product"=>"QUẢN LÝ SẢN PHẨM",
			"news"=>"QUẢN LÝ TIN TỨC",
			"log"=>"THOÁT",
		);
		if(!array_key_exists($zone,$arrMenu))
			$zone="product";
		/* END DEFINE ZONE */
			
	?>-->
	
	<!-- MENU -->
	<div id='menu' style='position:fixed'>	
		<a target='_blank' href="ckfinder/ckfinder.html"><div <?php echo ($zone==$key?"id='select'":"")?>>THƯ VIỆN HÌNH ẢNH</div></a>		
		<?php foreach ($arrMenu as $key=>$value) {?>
		<a href="?zone=<?php echo $key;?>"><div <?php echo ($zone==$key?"id='select'":"")?>><?php echo $value?></div></a>
		<?php }?>	
	</div>
	<!-- END MENU -->
	
	<!-- CONTENT -->
	<div id='content'>
	<?php 
		$act=($_POST["act"]==""?"index":$_POST["act"]);
		include("modules/$zone/$act.php");
	?>	
	</div>
	<!-- END CONTENT -->
	
	<?php	
		/* CLOSE CONNECTION */
		mysql_close();	
		/* END CLOSE CONNECTION */	
	?>
	
</body>
</html>
